<%@ page language="java"  contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<html>
<head>
<title>配置管理-新建/更新配置类别</title>
<%@ include file="/commons/meta.jsp" %>
<%@ include file="/commons/header.jsp" %>
<%@ include file="/extjs/jsps/importExt.jsp" %>
<%@ include file="/extjs/jsps/importEasyExt.jsp" %>
<script language="javascript" type="text/javascript">
function closeCurrentWindow(result) {
	var winId='${winId}';
	var closeWin=Ext.WindowMgr.get(winId);
	if(closeWin==null) {
		closeWin=parent.Ext.WindowMgr.get(winId);
	}
	if(closeWin==null) {
		window.returnValue=result;
		window.close();
	}else {
		closeWin.returnValue=result;
		closeWin.close();
	}
}
Ext.onReady(function() {
	
	var formPanel = new Ext.form.FormPanel({
		bodyStyle: 'padding: 10 10 10 10;',
		defaultType: 'textfield',
		labelAlign: 'right',
		labelWidth: 65,
		layout: 'form',
		autoWidth: true,
		autoScroll: true,
		defaults: {
			allowBlank: false,
			anchor: '100%',
			msgTarget: 'qtip'
		},
		items: [{
			xtype: 'hidden',
			name: 'id'
		},{
			fieldLabel: '名称',
			name: 'name',  
			maxLength: 64
		},{
			fieldLabel: '编码',
			name: 'type',  
			maxLength: 64
		},{
			fieldLabel: '备注',
			name: 'memo',  
			xtype: 'textarea',
			allowBlank: true
		}],
		listeners: {
			afterRender: function(thiz) {
				var id='${id}';
				if(!Ext.isEmpty(id)&&id!='null') {
					Common.loadForm(thiz,('${ctx}/codeSort!getJSON.action'),{id: id});
				}
			}
		},
		bbar: [{
			text: '保存',
			iconCls: 'acceptBtn',
			handler: function() {
				var action;
				var id='${id}';
				var isUpdate=!Ext.isEmpty(id)&&id!='null';
				var url='${ctx}/codeSort!'+(isUpdate?'updateJSON':'insertJSON')+'.action';
				Common.submitForm(formPanel,url,function(success) {
					if(success) {
						closeCurrentWindow(true);
					}
				});
			}
		},'-',{
			iconCls: 'delete2Btn',
			text: '取消',
			handler: function() {
				closeCurrentWindow(false);
			}
		}]
	});
	
	var viewport = new Ext.Viewport({
		layout: 'fit',
		items: [formPanel]
	});
});
</script>
</head>

<body>
</body>
</html>